﻿#ifndef EXPERIMENTINFO_H
#define EXPERIMENTINFO_H

#include <QObject>
#include <QQmlContext>
#include <dbHelper.h>
#include <CommonHelper.h>
#include <tcpclient.h>
#include <QElapsedTimer>
#include <loghelper.h>
#include <eqptinfo.h>
#include <GetTempThread.h>
#include <QFileDialog>
#include <wlkOperator.h>
#include <QMessageBox>
#include "xlsxdocument.h"
#include <SerialPortClient.h>

class ExperimentInfo : public QObject
{
    Q_OBJECT

public:
    ExperimentInfo();
    ~ExperimentInfo();
signals:
    void startTempThread();

public:
    Q_INVOKABLE void startExperiment(QVariantMap,QVariantList,QString);
    Q_INVOKABLE void onePointStartExperiment(QVariantMap);
    Q_INVOKABLE QVariantMap getExperimentInfo(QString);
    Q_INVOKABLE QVariantList getSampleInfo(QString);
    Q_INVOKABLE void openDoor(QString);
    Q_INVOKABLE void closeDoor(QString);

    Q_INVOKABLE QStringList selsamplename();//样本名获取
    Q_INVOKABLE QStringList selsampletype();//样本类型获取
    Q_INVOKABLE QVariantList samplein();
private:
    QString saveExperimentInfo(QVariantMap);
    int saveSampleInfo(QVariantList,QString);
    void distributeData(QString,QString);
    int saveWlkFile(QString,QString);
    void startExperimentResult();

private:
    CommonHelper *common;
    loghelper *logClient;
    QString equGuid;
    GetTempThread* tempThread = nullptr;
    int sendNum;
    QByteArray finalInfo;
    QString sendResult;
    QString expGuid;
    bool responseReceived;
};
#endif // EXPERIMENTINFO_H
